<?php

$currencies = array_index($db->fetchAll("SELECT * FROM shop_currencies"), 'iso');
if (isset($_REQUEST['currency'])) {
	if ($db->fetchOne("SELECT iso FROM shop_currencies WHERE iso=?", strtoupper($_REQUEST['currency']))) {
		$_SESSION['currency'] = strtoupper($_REQUEST['currency']);
	}
}

$shop_images = glob($app_root . $site['home_dir'] . '/shop-images/*/*.jpg');
function shop_get_images($type, $match) {
	global $shop_images;
	#if ($type=='products') echo $match;
	$images = array_filter($shop_images, create_function('$img', "return preg_match('/{$type}\/{$match}(\.jpg|_\d+\.jpg)$/', \$img);"));
	sort($images);
	foreach($images as $i => $image) {
		$images[$i] = filemtime($image) . '/' . basename($image);
	}
	return $images;
}